package quick;

public class Quick01 {
    public static void sort(int[] arr,int left,int right){
        if(left >= right)return;
        int i = left, j = right;
        //取第一个数作为基数
        int temp = arr[left];
        while(i < j){
            //先从右往左找，填第一个坑
            while (i < j && arr[j] > temp)j--;
            if(i < j)arr[i++] = arr[j];
            while (i < j && arr[i] < temp)i++;
            if(i < j)arr[j--] = arr[i];
        }
        arr[i] = temp;
        sort(arr,left,i-1);
        sort(arr,i+1,right);
    }
}
